<script>

var user = false;
var pedido = false;
var userId = false;
var edpedido = "";

function habilitaMenu()
{
	$(".menu_login").animate({opacity: 1}, 500, function(){});
}

function desabilitaMenu()
{
	$(".menu_login").animate({opacity: 0.5}, 800, function(){});

	$(".menu_home").click();

	

	return true;
}

function msg(json)
{
	$("#msg").css("color", "white");
	
	if(json.type == "alert")
	{
		$("#msg").css("color", "red").css("border", "1px solid red");
	}
	
	$("#msg").html(json.vmsg).fadeIn();

	setTimeout(function(obj) { $("#msg").fadeOut(); }, json.time, this);
}

$(function(){
	$("#mainMenu div").click(function()
	{
		if(pedido)
		{
			if(confirm("Deseja deletar o pedido?"))
			{
				pedido = false;
				
				$.post('<?php echo $this->base; ?>/pedido/delete', {cod_pedido: cod_item}, function(req){});
			}
			else
			{
				return;
			}
		}

		//$(".date").datepicker({dateFormat: 'dd/mm/yy', showAnim: 'fadeIn', yearRange: '2000:2040'});

		if($(this).attr("id") == "menu_logoff")
		{
			return;
		}
		
		if(!user)
		{
			msg({vmsg: "Nenhum usuario logado.", time: 3000});

			return false;
		}
		
		$("#mainMenu div").css("background", "none").removeClass("selected_menu").addClass("menu_normal");
		$("#menu_logoff").css("background", "#EF9200");
		$(this).css("background", "white").removeClass("menu_normal").addClass("selected_menu");

		$("#blank_scr").fadeIn("fast");
		$("#content").fadeOut("fast");

		$("#menu_cnew").click(function(){
			$("#userNumberTxt").focus();
		});

		$.ajax({
			url     : $(this).attr("id"),
			success : function(result){
				$("#content").html(result);
				
				$("#blank_scr").fadeOut("fast");
				$("#content").fadeIn("fast");
			}
		});
		
	});
});
</script>

<style>

#mainMenu div:hover{
	cursor: pointer;
}

.selected_menu{
	border-top: 2px solid #EF9200;
	border-left: 2px solid #EF9200;
	border-right: 2px solid #EF9200;
	height: 50px;
}

.menu_normal{
	//border-right: 1px solid white;
	color: white;
}


</style>

<div id="blank_scr" style="display: none; text-align: center; width: 200px; z-index: 1000; left: 50%; margin-left: -100px; position: fixed; top: 55%; margin-top: -100px; padding: 10px; opacity: 0.95;">
	<img style="margin-top: 20%;" src="<?php echo $this->base; ?>/public/images/ajax-loader.gif" alt="" />
	<br />
	<?php echo ucfirst($this->translate->translate("loading")); ?>
</div>

<div id="mainMenu" style="height: 70px; background-color: #FF9900; border-bottom: 2px solid #EF9200;">
	<div id="menu_logoff" onclick="logoff();" class="menu_normal menu_login" style="height: 50px; opacity: 0.5; padding: 10px; text-align: center; float: right; font-weight: bold; width: 100px;  background-color: #EF9200;">
		<img src="<?php echo $this->base; ?>/public/images/actions/logoff.png" />
		<br />
		<font style="font-family: arial;">Logoff</font>
	</div>
	<div id="<?php echo $this->base; ?>/index/home" class="selected_menu ui-corner-top menu_home" style="padding: 10px; height: 50px; text-align: center; float: right; font-weight: bold; border-bottom: 0; width: 100px; background-color: white;">
		<img src="<?php echo $this->base; ?>/public/images/actions/home.png" />
		<br />
		<font style="font-family: arial;">Home</font>
	</div>
</div>